package com.edu.demo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import java.util.Comparator;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;

/**
 * <p>
 * 院系
 * </p>
 *
 * @author jixuewei
 * @since 2023-01-12
 */
@ApiModel(value = "Department对象", description = "院系")
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Department implements Serializable, Comparable<Department> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    private String deptName;

    @ApiModelProperty("学院编号")
    private String deptCode;

    private Integer sort;

    @ApiModelProperty("所在学校地点")
    private String address;

    @ApiModelProperty("负责人")
    private String charger;

    @ApiModelProperty("学院介绍")
    private String introduction;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    public String getDeptCode() {
        return deptCode;
    }

    public void setDeptCode(String deptCode) {
        this.deptCode = deptCode;
    }

    public String getAddress() {
        return address;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer order) {
        this.sort = order;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getCharger() {
        return charger;
    }

    public void setCharger(String charger) {
        this.charger = charger;
    }

    public String getIntroduction() {
        return introduction;
    }

    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }

    @Override
    public String toString() {
        return "Department{" +
            "id = " + id +
            ", deptName = " + deptName +
            ", deptCode = " + deptCode +
            ", address = " + address +
            ", charger = " + charger +
            ", introduction = " + introduction +
        "}";
    }

    @Override
    public int compareTo(Department department) {
        Integer i = 0;
         if(this.getSort() > department.getSort()) i = 1;
         else if(this.getSort() == department.getSort()) i=0;
         else i = -1;
         return i;
    }


    //    @Override
//    public int compare(Department department, Department t1) {
//         Integer i = 0;
//         if(department.getSort() > t1.getSort()) i = 1;
//         else if(department.getSort() == t1.getSort()) i=0;
//         else i = -1;
//         return i;
//    }
}
